﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using TransFormer.BLL;
using TransFormer.Common;

namespace TransFormer.Web
{
    public partial class News : System.Web.UI.Page
    {
        protected List<Model.Article> NewsList;

        private BLL.Article _articleBll = new Article();
        private BLL.KeyWords _bllKey = new TransFormer.BLL.KeyWords();
        protected void Page_Load(object sender, EventArgs e)
        {
            var model2 = _bllKey.GetModel(4);
            if (model2 != null)
            {
                HtmlMeta keywords = new HtmlMeta();
                keywords.Name = "keywords";
                keywords.Content = model2.KeyContent;
                Page.Header.Controls.Add(keywords);
                HtmlMeta desc = new HtmlMeta();
                desc.Name = "description";
                desc.Content = model2.PageDesc;
                Page.Header.Controls.Add(desc);
                Title = model2.Title;

            }
            const int pageSize = 5;
            int pageIndex = 1;
            int.TryParse(Request["pageIndex"], out pageIndex);
            int count = 0;
            //if (IsPostBack) return;
            NewsList = _articleBll.GetModelList("Language='english'")
                .Skip((pageIndex - 1)*pageSize).Take(pageSize).ToList();
            count = _articleBll.GetRecordCount("Language='english'");
            PageStr = LaomaPager.ShowPageNavigate(pageSize, pageIndex, count, "News.aspx?id=0");
        }

        protected string PageStr { get; set; }
    }
}